﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UI
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Show();
        }
        public static Dictionary<string, string> users = new Dictionary<string, string>();
        private void Form1_Load(object sender, EventArgs e)
        {
            users.Add("sa", "123456");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var uid = txtUname.Text;
            var pwd = txtUpwd.Text;

            var usr = users.Where(x => x.Key == uid && x.Value == pwd).FirstOrDefault();

            var userName = "sa";
            var passWord = "123456";

            if (usr.Key != null && usr.Value != null )
            {
                MessageBox.Show("登入成功", "提示");
                MainForm mainForm = new MainForm();
                this.Hide();
                mainForm.Show();

            }
            else
            {
                MessageBox.Show("登入失败", "提示");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            RegisterFrom registerFrom = new RegisterFrom();
            this.Hide();
            registerFrom.Show();
        }
    }
}
